package com.zhang.sql;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

/**
 * @title: 自定义UDTF 炸裂函数
 * @author: zhang
 * @date: 2022/2/16 20:51
 */
@FunctionHint(output = @DataTypeHint("ROW<word STRING>"))
public class SplitFunction extends TableFunction<Row> {
    public void eval(String str) {
        String[] fields = str.split(" ");
        for (String field : fields) {
            collect(Row.of(field));
        }
    }
}
